// params参数：路径参数
// query参数：查询字符串
import store from '@/store'
import request from '@/utils/request'
// 获取验证码
export const requestCode=(mobile)=>request({url:`/sms/codes/${mobile}`,method:'get'})

// 登录注册--获取token
export const requestLogin = (params)=>request({url:'/authorizations',method:'post',data:params}) 

// 获取用户信息
export const requestUserInfo = ()=>request({url:'/user',method:'get'})

// 获取用户自己信息
export const requestUser = (target)=>request({url:`/user/${target}`,method:'get'})

// 获取用户个人资料
export const requestUserData =()=>request({url:'/user/profile',method:'get'})

// 获取用户的关注列表
// {page:,per_page}
export const reqeustFocus = (params)=>request({url:'/user/followings',method:'get',params})

// 获取用户的粉丝列表
export const reqeustFans = ()=>request({url:'/user/followers',method:'get'})

// 更新token



// 获取用户的渠道列表
export const requestUserChannel=()=>request({url:'/user/channels'})

// 获取全部频道列表
export const requestAllChannel=()=>request({url:'/channels'})

// 获取指定渠道的新闻
export const requestnews=(params)=>request({url:'/articles',params})

// 获取新闻详情
export const requestDetail=(id)=>request({url:`/articles/${id}`})

// 收藏文章
export const reqeustCollect=(id)=>request(
    {
        url:'/article/collections',
        method:'post',
        data:{
            target:id
        }
    }
    )
// 取消收藏文章
export const reqeustOnCollect=(id)=>request(
    {
        url:`/article/collections/${id}`,
        method:'DELETE',
    }
    )

// 对文章点赞
export const reqeustLike=(id)=>request(
    {
        url:`/article/likings`,
        
        method:'post',
        data:{
            target:id,
        }
    }
    )
// 取消点赞
export const reqeustOnLike=(id)=>request(
    {
        url:`/article/collections/${id}`,
        method:'DELETE',
    }
    )